Skip to content

compiler: error on inputs declared under custom jobs - #48607

Merged
pelikhan merged 2 commits into
mainfrom
copilot/detect-custom-job-inputs
Jul 28, 2026
Merged

compiler: error on inputs declared under custom jobs#48607
pelikhan merged 2 commits into
mainfrom
copilot/detect-custom-job-inputs

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

jobs.*.inputs is not a valid GitHub Actions field for regular jobs (only reusable workflow callers support it). Declaring it on a custom job was silently ignored, masking misconfiguration.

Changes

  • pkg/workflow/compiler_custom_jobs.goextractCustomJobCoreProperties now returns a compilation error when inputs is present in the job config:
    jobs.<name>.inputs: inputs are not supported on jobs; use 'env' to pass values to job steps
    
  • pkg/workflow/compiler_custom_jobs_test.goTestBuildCustomJob_InputsNotSupportedError covers the new error path.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add compilation error for inputs declared on custom jobs compiler: error on inputs declared under custom jobs Jul 28, 2026
Copilot AI requested a review from pelikhan July 28, 2026 12:21
@pelikhan
pelikhan marked this pull request as ready for review July 28, 2026 12:21
Copilot AI review requested due to automatic review settings July 28, 2026 12:21
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #48607 does not have the 'implementation' label and has only 31 new lines of code in business logic directories (threshold: 100).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds validation intended to reject unsupported jobs.*.inputs declarations.

Changes:

  • Adds an actionable compilation error for custom-job inputs.
  • Adds unit coverage for the error path.
Show a summary per file
File Description
pkg/workflow/compiler_custom_jobs.go Rejects inputs on custom jobs.
pkg/workflow/compiler_custom_jobs_test.go Tests direct custom-job validation.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

pkg/workflow/compiler_custom_jobs.go:179

  • For a reusable-workflow caller (uses), this remediation is invalid because caller jobs cannot use env; reusable-workflow inputs must be passed with with. Tailor the guidance for uses jobs so this error does not direct users to another invalid configuration.
		return fmt.Errorf("jobs.%s.inputs: inputs are not supported on jobs; use 'env' to pass values to job steps", jobName)
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

}

func (c *Compiler) extractCustomJobCoreProperties(job *Job, jobName string, configMap map[string]any) error {
if _, hasInputs := configMap["inputs"]; hasInputs {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in a3561ac. I added a pre-schema validation in parser validation flow so jobs.<name>.inputs now fails before JSON schema, and added both parser-level and compile-string end-to-end tests to verify the actionable error is returned (not the generic unknown-property message). Kept the compiler-side check as defense-in-depth for direct builder paths that bypass schema.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is minimal and correct. The early guard in extractCustomJobCoreProperties is placed appropriately, the error message is actionable, and the test covers both the error path and the expected message. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 8.68 AIC · ⌖ 5.16 AIC · ⊞ 5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — changes look solid. Approving.

📋 Key Themes & Highlights

Key Themes

  • Correct guard placement: the inputs check runs before any other property extraction, failing fast and clearly.
  • Clear error message: names the invalid field path (jobs.<name>.inputs) and recommends the fix (use env).

Positive Highlights

  • ✅ Regression test added alongside the fix — good /tdd practice.
  • ✅ Test asserts both the error path and the specific message content.
  • ✅ Minimal, surgical change with no unrelated side-effects.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 12.7 AIC · ⌖ 4.58 AIC · ⊞ 6.7K
Comment /matt to run again

@github-actions github-actions Bot mentioned this pull request Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 85/100 — Excellent

Analyzed 1 test: 1 design, 0 implementation, 0 violation(s).

📊 Metrics (1 test)
Metric Value
Analyzed 1 (Go: 1, JS: 0)
✅ Design 1 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (100%)
Duplicate clusters 0
Inflation No (27 test lines / 4 prod lines = 6.75:1)
🚨 Violations 0
Test File Classification Issues
TestBuildCustomJob_InputsNotSupportedError pkg/workflow/compiler_custom_jobs_test.go:205 Design test, error case None

Analysis

TestBuildCustomJob_InputsNotSupportedError (pkg/workflow/compiler_custom_jobs_test.go:205):

  • Design Invariant: Inputs field is not supported on custom jobs; users must use env instead.
  • Assertions (3): Validates error is raised, contains jobs.my-job.inputs message, and contains constraint explanation.
  • Edge-case coverage: Explicitly tests the error path, not just happy path.
  • Quality: Direct, focused behavioral contract test. No mocks, clean setup, proper build tag present.

Verdict

passed. 100% design tests (threshold: 30%). No violations detected.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 16 AIC · ⌖ 8.87 AIC · ⊞ 8.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: 85/100. 100% design tests (threshold: 30%). No violations detected.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: no blocking issues, but the added check is unreachable dead code in the normal compile path

The new inputs guard in extractCustomJobCoreProperties never fires during a real gh aw compile run — schema validation already rejects jobs.<name>.inputs before buildCustomJob is called.

💡 Details

I verified that ValidateMainWorkflowFrontmatterWithSchemaAndLocation (invoked before buildCustomJob in both compiler_orchestrator_frontmatter.go and compiler_string_api.go) already rejects jobs.<name>.inputs via JSON schema: main_workflow_schema.json's job properties list does not include inputs, and additionalProperties: false is set on jobs. I compiled a test workflow with inputs: under a custom job and it failed at the schema layer with Unknown property: inputs, before the code in this PR is ever reached.

The only way the new Go-level error path executes is the new unit test, which calls compiler.buildCustomJob(...) directly, bypassing schema validation entirely. This may be reasonable defense-in-depth if buildCustomJob/CompileWorkflowData can be invoked from another path that skips schema validation, but the PR description's claim that inputs "was silently ignored, masking misconfiguration" appears inaccurate for the standard CLI compile flow — it was already a hard compile error at the schema stage. Please confirm there is a genuinely reachable path where schema validation is skipped and this check adds value; otherwise this is redundant code justified by a misleading problem statement.

Not blocking merge since it introduces no incorrect behavior, but worth clarifying before merge.

🔎 Code quality review by PR Code Quality Reviewer · sonnet50 · 39.1 AIC · ⌖ 4.36 AIC · ⊞ 7.4K
Comment /review to run again

Comment on lines +178 to +179
if _, hasInputs := configMap["inputs"]; hasInputs {
return fmt.Errorf("jobs.%s.inputs: inputs are not supported on jobs; use 'env' to pass values to job steps", jobName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is dead code in the real compile path — schema validation already rejects jobs.<name>.inputs before buildCustomJob is ever called.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a3561ac by adding pre-schema validation for jobs.<name>.inputs plus end-to-end coverage through ParseWorkflowString, so the normal compile path now emits the actionable jobs.inputs error instead of a generic schema unknown-property message.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. I ran the pr-finisher flow and pushed follow-up fixes in a3561ac to address the unresolved review feedback.

@pelikhan
pelikhan merged commit 295dcec into main Jul 28, 2026
28 checks passed
@pelikhan
pelikhan deleted the copilot/detect-custom-job-inputs branch July 28, 2026 13:11
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants